﻿using System;

namespace StructureMap.TypeMockAutoMocker
{
	public interface IConsumer
	{
		IMock Mock { get; }

		int CallMock(int parameter);

		int Get8();
	}

	public abstract class AbstractCutWithAbstractMock: IConsumer
	{
		private readonly IMock _mock;

		public AbstractCutWithAbstractMock(IMock mock)
		{
			_mock = mock;
		}

		#region IConsumer Members

		public IMock Mock
		{
			get { return _mock; }
		}

		public int CallMock(int parameter)
		{
			return Mock.Call(parameter);
		}

		public abstract int Get8();

		#endregion
	}

	public abstract class AbstractCutWithConcreteMock: IConsumer
	{
		private readonly ConcreteProvider _provider;

		public AbstractCutWithConcreteMock(ConcreteProvider provider)
		{
			_provider = provider;
		}

		#region IConsumer Members

		public IMock Mock
		{
			get { return _provider; }
		}

		public int CallMock(int parameter)
		{
			return Mock.Call(parameter);
		}

		public abstract int Get8();

		#endregion

		public int Get9()
		{
			return 9;
		}
	}

	public class ConcreteCutWithAbstractMock: AbstractCutWithAbstractMock
	{
		public ConcreteCutWithAbstractMock(IMock mock)
			: base(mock)
		{}

		public override int Get8()
		{
			return 8;
		}
	}

	public class ConcreteCutWithConcreteMock: AbstractCutWithConcreteMock
	{
		public ConcreteCutWithConcreteMock(ConcreteProvider provider)
			: base(provider)
		{}

		public override int Get8()
		{
			return 8;
		}
	}

	public class ConcreteProvider: IMock
	{
		#region IMock Members

		public int Call(int parameter)
		{
			return parameter;
		}

		#endregion
	}

	public interface IMock
	{
		int Call(int parameter);
	}
}